<%@page import="study.itwill.common.DateTime"%>
<%@page import="study.itwill.team5.admin.AdminItem"%>
<%@page import="study.itwill.jsp.WebHandler"%>
<%@page import="study.itwill.team5.board.BoardCategoryItem"%>
<%@page import="study.itwill.team5.board.BoardCategory"%>
<%@page import="study.itwill.common.DBHandler"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ page trimDirectiveWhitespaces="true"%>
<%@ include file="../session.jsp"%>
<%@ include file="../dbcon.jsp"%>
<%
	DateTime datetime = DateTime.getInstance();

	int seq = web.getInt("seq");
	
	if (seq == -1) {
		db.disconnect();
		web.goPage(null, "파라미터가 잘못되었습니다.");
		return;
	}
%>
<%
	
	/** 회원데이터 조회 */
	BoardCategory category = new BoardCategory();
	BoardCategoryItem item = category.viewBoardCategory(seq);
	
	if (item == null) {
		db.disconnect();
		web.goPage(null, "데이터 조회에 실패했습니다. 잠시후 다시 시도해 주세요.");
		return;
	}
%>
<!DOCTYPE html>
<html lang="ko">
<head>
<%@ include file="../head.jsp"%>
</head>
<body>
	<%@ include file="../menu.jsp"%>
	<div class="container">
		<div class="page-header">
			<h1>게시판 카테고리 정보 보기</h1>
		</div>

		<form id="frmBoardCategoryView" class="form-horizontal" role="form"
			method="post" action="">

			<!-- 게시판 카테고리 자동입력 -->
			<input type="hidden" name="seq" value="<%=seq%>">

			<fieldset>

				<div class="form-group">
					<label for="category_name" class="col-md-2 control-label">카테고리
						이름</label>
					<div class="col-md-10">
						<p class="form-control-static"><%=item.getCategory_name()%></p>
					</div>
				</div>

				<div class="form-group">
					<label for="reg_date" class="col-md-2 control-label">등록일자</label>
					<div class="col-md-10">
						<p class="form-control-static"><%= datetime.getDateTimeString(item.getReg_date()) %></p>
					</div>
				</div>

				<div class="form-group">
					<label for="edit_date" class="col-md-2 control-label">수정일자</label>
					<div class="col-md-10">
						<p class="form-control-static"><%= datetime.getDateTimeString(item.getEdit_date()) %></p>
					</div>
				</div>

				<div class="form-group">
					<div class="col-md-offset-2 col-md-10">
						<div class="row">
							<div class="col-md-4">
								<a href="listBoardCategory.jsp"
									class="btn btn-primary btn-block">목록보기</a>
							</div>
							<div class="col-md-4">
								<button type="submit" id="edit"
									formaction="editBoardCategory.jsp" formmethod="post"
									class="btn btn-info btn-block">수정하기</button>
							</div>
							<div class="col-md-4">
								<button type="submit" id="delete"
									formaction="deleteBoardCategoryOk.jsp" formmethod="post"
									class="btn btn-danger btn-block">삭제하기</button>
							</div>
						</div>
					</div>
				</div>

			</fieldset>
		</form>
	</div>
	<% db.disconnect(); %>
	<!-- Javascript -->
	<script src="/Team-Project/assets/js/jquery.js"></script>
	<script src="/Team-Project/assets/js/bootstrap.min.js"></script>

	<script type="text/javascript">
		$(function() {
			// id 속성이 "delete"인 요소에 대한 click이벤트
			$("#delete").click(function() {
				// 사용자에게 물어본다.
				if (!confirm("정말 삭제하시겠습니까?")) {
					// 취소를 선택한 경우 처리 둥단
					return false;
				}
			});
		});
	</script>

</body>
</html>